﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;

namespace SZORM.Factory.Oracle
{
    public class OracleCommand : DbCommand, IDisposable
    {
        DbCommand _dbCommand;
        public OracleCommand(DbCommand dbCommand)
        {
            this._dbCommand = dbCommand;
        }

        public override string CommandText
        {
            get
            {
                return this._dbCommand.CommandText;
            }
            set
            {
                this._dbCommand.CommandText = value;
            }
        }
        public override int CommandTimeout
        {
            get
            {
                return this._dbCommand.CommandTimeout;
            }
            set
            {
                this._dbCommand.CommandTimeout = value;
            }
        }
        public override CommandType CommandType
        {
            get
            {
                return this._dbCommand.CommandType;
            }
            set
            {
                this._dbCommand.CommandType = value;
            }
        }
        public override UpdateRowSource UpdatedRowSource
        {
            get
            {
                return this._dbCommand.UpdatedRowSource;
            }
            set
            {
                this._dbCommand.UpdatedRowSource = value;
            }
        }

        protected override DbConnection DbConnection { get =>this._dbCommand.Connection; set => this._dbCommand.Connection=value; }

        protected override DbParameterCollection DbParameterCollection => throw new NotImplementedException();

        protected override DbTransaction DbTransaction { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
        public override bool DesignTimeVisible { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

        public override void Cancel()
        {
            this._dbCommand.Cancel();
        }
        public override int ExecuteNonQuery()
        {
            return this._dbCommand.ExecuteNonQuery();
        }
        public IDataReader ExecuteReader(CommandBehavior behavior)
        {
            return new OracleDataReader(this._dbCommand.ExecuteReader(behavior));
        }
        public override void Prepare()
        {
            this._dbCommand.Prepare();
        }
        public void Dispose()
        {
            this._dbCommand.Dispose();
        }

        protected override DbParameter CreateDbParameter()
        {
            return this._dbCommand.CreateParameter();
        }

        protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
        {
            return this._dbCommand.ExecuteReader();
        }

        public override object ExecuteScalar()
        {
            return this._dbCommand.ExecuteScalar();
        }
    }
}
